<?php
namespace Amis\functions;

use Amis\Basics\AmisBasics;

class PopOver extends AmisBasics
{
    public function mode($type = 'popOver')
    {
        if (in_array($type, ['popOver', 'dialog', 'drawer'])) {
            $this->mode = $type;
        }
        return $this;
    }

    public function position($type = '')
    {
        if (in_array($type, [
            'center', 'left-top', 'right-top', 'left-bottom', 'right-bottom', 'left-top-right-bottom', 'left-center-right-center',
            'fixed-center', 'fixed-left-top', 'fixed-right-top', 'fixed-left-bottom', 'fixed-right-bottom',
        ])) {
            $this->position = $type;
        }
        return $this;
    }

    public function offset($top = 0, $left = 0)
    {
        $this->offset = ['top' => $top, 'left' => $left];
        return $this;
    }

    public function trigger($trigger)
    {
        $this->trigger = $trigger;
        return $this;
    }

    public function showIcon(bool $showIcon = true)
    {
        $this->showIcon = $showIcon;
        return $this;
    }

    public function title($title)
    {
        $this->title = $title;
        return $this;
    }

    public function body($body)
    {
        $this->body = $body;
        return $this;
    }

    public function size($size)
    {
        $this->size = $size;
        return $this;
    }

    public function lineStyle($lineStyle = 'dashed')
    {
        $this->lineStyle = $lineStyle == 'dashed' ?: 'solid';
        return $this;
    }
}